/*
 * Copyright (c) 2010 Philip Foulkes <philip.foulkes@gmail.com>
 *
 * This file is free software and is made available under the 
 * terms of the GNU General Public License, version 2, or at your
 * option, any later version
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef _MRP_PERIODIC_TRANSMISSION_H_
#define _MRP_PERIODIC_TRANSMISSION_H_

/**
*    PeriodicTransmission state table
*/
#define MRP_PERIODIC_TRANSMISSION_STATE_MIN			70 // This needs to be set to the value of the first item in this list 
#define MRP_PERIODIC_TRANSMISSION_STATE_ACTIVE 		70
#define MRP_PERIODIC_TRANSMISSION_STATE_PASSIVE		71
#define MRP_PERIODIC_TRANSMISSION_STATE_MAX			71 // This needs to be set to the value of the last item in this list 
#define MRP_PERIODIC_TRANSMISSION_STATE_NO_CHANGE 	72 // This needs to be one more than the last itme in the list
#define MRP_PERIODIC_TRANSMISSION_STATE_NUM			(MRP_PERIODIC_TRANSMISSION_STATE_MAX - MRP_PERIODIC_TRANSMISSION_STATE_MIN + 1)

#include "mrp_state_machine.h"

struct mrp_periodic_transmission
{
	struct mrp_state_machine mrp_state_machine; /* this has to be the first member */
	
	struct timer_list periodictimer;
	
	struct mrp * mrp;
};

struct mrp_periodic_transmission * mrp_periodic_transmission_create_and_init (void);
void mrp_periodic_transmission_destroy(struct mrp_periodic_transmission ** mrp_periodic_transmission);

int mrp_periodic_transmission_set_mrp(struct mrp_periodic_transmission * mrp_periodic_transmission, struct mrp * mrp);

void mrp_periodic_transmission_stop_timer(struct mrp_periodic_transmission * mrp_periodic_transmission); 

#endif
